<?php

require_once('constants.php');

require_once(SRC_DIR.DS.'Library/Util.php');

require_once(SRC_DIR.DS.'Core/Loader/Locator.php');

require_once(SRC_DIR.DS.'Core/Loader/FileLocator.php');

require_once(SRC_DIR.DS.'Core/Loader/ServiceLocator.php');

require_once(SRC_DIR.DS.'Core/Loader/FlourishLocator.php');

ServiceLocator::attachLocator(new FileLocator(SRC_DIR. '/Core'), 'Core');

require_once('config.php');

try
{
    Config::getInstance()->init($config);

    $bootstrap = Bootstrap::getInstance();

    $bootstrap->addSetupObj(Setup_Abstract::getInstance('Setup_Autoload'));

    $bootstrap->addSetupObj(Setup_Abstract::getInstance('Setup_ErrorReporting'));

    $bootstrap->addSetupObj(Setup_Abstract::getInstance('Setup_Session'));

    $bootstrap->addSetupObj(Setup_Abstract::getInstance('Setup_Router'));

    $output = $bootstrap->init()->getOutput(); 
}
catch(Exception $e)
{
    $output = $e->getMessage();
}

require_once(Config::get('app.template'));